package com.clas.liu.myapplication.presenter.impl;

import android.os.Handler;
import android.os.Message;

import com.clas.liu.myapplication.model.event.UserInfoEvent;
import com.clas.liu.myapplication.model.impl.UserInfoModel;
import com.clas.liu.myapplication.presenter.i.IReportPresenter;
import com.clas.liu.myapplication.view.activity.impl.ReportActivity;

/**
 * Created by liu on 2019/5/22.
 */

public class ReportPresenter extends BasePresenter<ReportActivity, UserInfoModel> implements IReportPresenter {
    public ReportPresenter(ReportActivity view) {
        super(view);
    }

    @Override
    public void report(int userId, String text, String pic, String releaseTime) {
        mModel.jubaoInfo(userId, text, pic, releaseTime);
    }

    @Override
    protected UserInfoModel getModel(Handler handler) {
        return new UserInfoModel(handler);
    }

    @Override
    protected void eventReceive(Message msg) {
        switch (msg.what) {
            case UserInfoEvent.JUBAO_USER_OK:
                mView.reportReturn();
                break;
            case UserInfoEvent.JUBAO_USER_FAIL:
                mView.failBecauseNetReturn(msg.what);
                break;
        }
    }
}
